package com.kkkk.rest.common.exception;


import com.kkkk.rest.common.exception.code.ErrorCode;

public class AppException extends RuntimeException {
    private String code;
    /**
     * 异常相关字段(Json)
     */
    private String fields;

    private String service;

    public void setCode(String code) {
        this.code = code;
    }

    public void setFields(String fields) {
        this.fields = fields;
    }


    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public AppException(Throwable cause) {
        super(cause);
    }

    public AppException(String message) {
        super(message);
    }

    public AppException(String code, Throwable cause) {
        super(cause);
        this.code = code;
    }

    public AppException(String code, String message) {
        super(message);
        this.code = code;
    }

    public AppException(String code, String message, String fields, String service) {
        super(message);
        this.code = code;
        this.fields = fields;
        this.service = service;
    }

    public AppException(String code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public AppException(String code, String message, String fields, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.fields = fields;
    }

    public String getCode() {
        return code;
    }

    public String getFields() {
        return fields;
    }


    public AppException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }


}
